<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
//编写函数norepeat(arr) 将数组的重复元素去掉，并返回新的数组

// ```javascript
// var arr = [1, 1, 2, 3, 4, 4, 2, 1, 3, 5]

// function norepeat() {
//   // code in here ...
// }

// console.log(norepeat(arr)) // [1, 2, 3, 4, 5]

var arr = [1, 1, 2, 3, 4, 4, 2, 1, 3, 5]

function norepeat(a) {
    for( var i = 0 ;i < a.length; i++ ){
        var arr1 = new Array();
        if(arr[i]=arr[i+1]){
        a.splice(i,1)
        }
        
    }
    return a;
}
console.log(norepeat(arr));


    </script>
</body>
</html>